/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author tashiba
 */
public class CheckList {
   public static void bacaTabelYudisium(CekPeriode CP){
       PengendaliMahasiswa.DAFTAR_MAHASISWA= new ArrayList<Yudisium>();
       Connection conn = OraConnection.open("jdbc:oracle:thin:@localhost:1521:xe","HR", "elsa");
        java.sql.Statement statement = null;
        try {
            statement = conn.createStatement();
        } catch (SQLException ex) {
            Logger.getLogger(PengendaliSekretariat.class.getName()).log(Level.SEVERE, null, ex);
        }
        String sql = "select * from mahasiswa where nim = '" + CP.getNim() + "' and nama = '" + CP.getNama()+"'";
       ResultSet result = null;
        try {
            result = statement.executeQuery(sql);
        } catch (SQLException ex) {
            Logger.getLogger(PengendaliSekretariat.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            while (result.next()) {
                Yudisium temp = new Yudisium() {

                    public int hitungDenda(int lamaPinjam) {
                        throw new UnsupportedOperationException("Not supported yet.");
                    }
                };
                temp.setNama(result.getString("nama"));
                try {
                    temp.setNim(result.getString("nim"));
                } catch (Exception ex) {
                    Logger.getLogger(PengendaliSekretariat.class.getName()).log(Level.SEVERE, null, ex);
                }
                temp.setTelpEmail(result.getString("nomor_email"));
                temp.setProdi(result.getString("prodi"));
//                temp.setEmail(result.getString("email"));
                temp.setPeriode(result.getString("periode"));
                temp.setHari(result.getString("hari"));
                temp.setTanggal(result.getString("tanggal"));
                temp.setDaftarNilai(result.getString("daftar_nilai"));
                temp.setNaskahTA(result.getString("naskah_ta"));
                temp.setBebasPinjLab(result.getString("bebaspinjam_lab"));
                temp.setBebasPinjDosen(result.getString("bebaspinjam_dosen"));
                temp.setKP(result.getString("kp"));
                temp.setToefl(result.getString("toefl"));
                temp.setPengesahanTA(result.getString("ta"));
                temp.setSistemPoin(result.getString("sistem_poin"));
                temp.setRBM(result.getString("rbm"));
                temp.setKelengkapan(result.getString("kelengkapan"));
                PengendaliMahasiswa.DAFTAR_MAHASISWA.add(temp);
            }
        } catch (SQLException ex) {
            Logger.getLogger(PengendaliSekretariat.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            conn.close();
        } catch (SQLException ex) {
        }
   }
}
 

